<?php
 //taobao 发货物流单
define('IN_OS', true);

require(dirname(__FILE__) . '/includes/init.php'); 
require_once(ROOT_PATH . 'includes/lib_order.php');
require(ROOT_PATH . '/includes/modules/taobao.api/cls_api.php'); 
global $_CFG; 
	if($_REQUEST['status']=='' ) 
	{
	$stuats = "ALL";	
	}
	else {
	$stuats=$_REQUEST['status'];
	}    
if ($_REQUEST['act'] == 'list'){	
	//检查权限
	admin_priv();   
			//API用户参数
			$userParamArr = array(
				'fields' => 'tid,seller_nick,buyer_nick,delivery_start,delivery_end,out_sid,item_title,receiver_name,receiver_phone,receiver_mobile,receiver_location,status,type,freight_payer,seller_confirm,company_name',
				'page_size' => 20,
		     	'page_no' => ((isset($_GET['page']) && $_GET['page'] > 0) ? $_GET['page'] : 1)
			);  
	    if ($stuats!='ALL' ) 	$userParamArr['status']=$stuats; 
		$result = TOP_LogisticsOrdersDetailGet($userParamArr);
	    $smarty->assign('stuats',$stuats); 
	    $smarty->assign('ur_here', '物流信息');
		$smarty->assign('shipping_items', $result ); 
		assign_query_info();
		$smarty->display('api_tb_shipping.tpl');   //api_tb_shipping.php
}
elseif($_REQUEST['act'] == 'get_item'){ 
		if($_REQUEST['tid']!='' ) {
			$aryy1=$topParamArr;
			$aryy1['method']='taobao.trade.fullinfo.get';
			//API用户参数
	 		$userParamArr = array(
				'fields' => 'seller_nick,buyer_nick,title,type,created,sid,tid,seller_rate,buyer_rate,status, payment,discount_fee,adjust_fee, post_fee,total_fee,pay_time,end_time,modified,consign_time, buyer_obtain_point_fee,point_fee,real_point_fee,received_payment,commission_fee, buyer_memo,seller_memo,alipay_no,buyer_message,pic_path,iid,num,price, buyer_alipay_no,receiver_name,receiver_state,receiver_city,receiver_district, receiver_address,receiver_zip,receiver_mobile,receiver_phone,buyer_email, seller_alipay_no,seller_mobile,seller_phone,seller_name,seller_email, available_confirm_fee,has_postFee,timeout_action_time,snapshot_url,cod_fee,shipping_type,trade_memo,orders',
				'tid' => $_REQUEST[tid]
	     	); 
	     	$paramArr = $aryy1 + $userParamArr; 
	     	$result = TOP_TradeFullinfoGet($userParamArr); 
		    InsertIntoOrder($result['trade']); //传订单信息	
			echo ('下载成功! <a href="#" onclick="history.go(-1)">返回</a>');
		}
}
?>